import instance from './axiosConfig.ts';

// 类型别名：
// 响应数据类型约束
interface ResponseDataType {
    code: number; // 用,也行
    message: string;
    data: any;
    token?: string;
}

export function httpGet(url: string, params: object = {}): Promise<ResponseDataType> {
    return instance.get(url, { params })
}
export function httpPost(url: string, params: object = {}): Promise<ResponseDataType> {
    return instance.post(url, params)
}
export function httpDelete(url: string, params: object = {}): Promise<ResponseDataType> {
    return instance.delete(url, { params })
}
export function httpPut(url: string, params: object = {}): Promise<ResponseDataType> {
    return instance.put(url, params)
}   